package com.gimi.cloud.bbp.dao.dao.product;

import com.gimi.cloud.bbp.dao.myMapper.MyMapper;
import com.gimi.cloud.bbp.dto.product.LogisticsDTO;
import com.gimi.cloud.bbp.entity.product.LogisticsEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by shazhiwei on 2018/1/11.
 */
public interface LogisticsDao extends MyMapper<LogisticsEntity>{
    /**
     * 获取商品物流列表
     * @return
     */
    @Select("SELECT el.l_id,el.prod_id,el.lc_id,el.is_default,elc.company_name,elc.company_address,elc.company_tel FROM ec_logistics el LEFT JOIN ec_logistics_company elc ON el.lc_id = elc.lc_id WHERE el.prod_id = #{prodId} AND el.is_delete = 0;")
    List<LogisticsDTO> logisticsList(@Param(value = "prodId") String prodId);

    @Delete("DELETE FROM ec_logistics WHERE prod_id = #{prodId};")
    int deleteByProdId(@Param(value = "prodId") String prodId);

}
